#! /bin/sh
case "$1" in
start)
echo -n "Starting NRPE daemon..."
/usr/local/nagios/bin/nrpe -d -c /usr/local/nagios/etc/nrpe.cfg
echo "NRPE is started"
;;
stop)
echo -n "Stopping NRPE daemon..."
kill $(ps -ef | grep iperf | grep -v grep| awk '{print $2}');
sleep 10
echo " NRPE is stopped"
;;
restart)
$0 stop
sleep 2
$0 start
;;
*)
echo "Usage: nrpe start|stop|restart"
;;
esac
exit 0
